package com.test.test_002;

import java.lang.reflect.InvocationHandler;
/**
 * JAVA 动态代理（）
 * @author wangxh2
 *
 */
public class LoggerBussiness {
	public static void main(String args[]) {
		BusinessInterface o = new BusinessObject();
		InvocationHandler handler = new LoggerHandler(o);
//		BusinessInterface proxy = (BusinessInterface) Proxy.newProxyInstance(o
//				.getClass().getClassLoader(), o.getClass().getInterfaces(),
//				handler);
//		proxy.executeBusiness();
		
		LoggerHandler LLL = new LoggerHandler();
		BusinessInterface proxy = (BusinessInterface) LLL.createProxy(o);
		proxy.executeBusiness();
//		try {
//			Class<?> bi = Class.forName(o.getClass().getInterfaces()[0].getName(), false, o.getClass().getClassLoader());
//			System.out.println(bi);
//		} catch (ClassNotFoundException e) {
//			e.printStackTrace();
//		}
	}
}
